home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / cat.n / case.n < prev    next >
Text File  |  1995-07-25  |  4KB  |  67 lines

  1.  
  2.  
  3.  
  4.      ccccaaaasssseeee((((nnnn))))                     TTTTccccllll ((((7777....0000))))                     ccccaaaasssseeee((((nnnn))))
  5.  
  6.  
  7.  
  8.      _________________________________________________________________
  9.  
  10.      NNNNAAAAMMMMEEEE
  11.           case - Evaluate one of several scripts, depending on a given
  12.           value
  13.  
  14.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  15.           ccccaaaasssseeee _s_t_r_i_n_g ?iiiinnnn? _p_a_t_L_i_s_t _b_o_d_y ?_p_a_t_L_i_s_t _b_o_d_y ...?
  16.           ccccaaaasssseeee _s_t_r_i_n_g ?iiiinnnn? {_p_a_t_L_i_s_t _b_o_d_y ?_p_a_t_L_i_s_t _b_o_d_y ...?}
  17.      _________________________________________________________________
  18.  
  19.  
  20.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  21.           _N_o_t_e: _t_h_e ccccaaaasssseeee _c_o_m_m_a_n_d _i_s _o_b_s_o_l_e_t_e _a_n_d _i_s _s_u_p_p_o_r_t_e_d _o_n_l_y _f_o_r
  22.           _b_a_c_k_w_a_r_d  _c_o_m_p_a_t_i_b_i_l_i_t_y.  _A_t _s_o_m_e _p_o_i_n_t _i_n _t_h_e _f_u_t_u_r_e _i_t _m_a_y
  23.           _b_e _r_e_m_o_v_e_d _e_n_t_i_r_e_l_y.  _Y_o_u  _s_h_o_u_l_d  _u_s_e  _t_h_e  sssswwwwiiiittttcccchhhh  _c_o_m_m_a_n_d
  24.           _i_n_s_t_e_a_d.
  25.  
  26.           The ccccaaaasssseeee command matches _s_t_r_i_n_g against each of the  _p_a_t_L_i_s_t
  27.           arguments  in order.  Each _p_a_t_L_i_s_t argument is a list of one
  28.           or more patterns.  If any of these patterns  matches  _s_t_r_i_n_g
  29.           then  ccccaaaasssseeee  evaluates the following _b_o_d_y argument by passing
  30.           it recursively to the Tcl interpreter and returns the result
  31.           of  that  evaluation.   Each  _p_a_t_L_i_s_t argument consists of a
  32.           single pattern  or  list  of  patterns.   Each  pattern  may
  33.           contain  any of the wild-cards described under ssssttttrrrriiiinnnngggg mmmmaaaattttcccchhhh.
  34.           If a _p_a_t_L_i_s_t argument is  ddddeeeeffffaaaauuuulllltttt,  the  corresponding  body
  35.           will  be  evaluated  if  no  _p_a_t_L_i_s_t  matches _s_t_r_i_n_g.  If no
  36.           _p_a_t_L_i_s_t argument matches _s_t_r_i_n_g and  no  default  is  given,
  37.           then the ccccaaaasssseeee command returns an empty string.
  38.  
  39.           Two  syntaxes  are  provided  for  the  _p_a_t_L_i_s_t   and   _b_o_d_y
  40.           arguments.   The  first uses a separate argument for each of
  41.           the patterns  and  commands;  this  form  is  convenient  if
  42.           substitutions  are  desired  on  some  of  the  patterns  or
  43.           commands.  The second form places all of  the  patterns  and
  44.           commands  together into a single argument; the argument must
  45.           have proper list structure, with the elements  of  the  list
  46.           being  the  patterns and commands.  The second form makes it
  47.           easy to construct multi-line case commands, since the braces
  48.           around  the  whole  list  make  it  unnecessary to include a
  49.           backslash at the  end  of  each  line.   Since  the  _p_a_t_L_i_s_t
  50.           arguments  are  in  braces in the second form, no command or
  51.           variable substitutions are performed on  them;   this  makes
  52.           the  behavior  of  the  second form different than the first
  53.           form in some cases.
  54.  
  55.  
  56.      KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
  57.           case, match, regular expression
  58.  
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 7/17/95)
  64.  
  65.  
  66.  
  67.